<!-- posts grouped by category or tag -->

<div class="row">
  <ul class="col-lg-2" id="group-list">
      {% assign idx = 0 %}
      {% for group in include.groups }} %}
          <!-- somehow Jekyll will put all posts into `collection` category
            So here we need to filter out it
          -->
          {% assign group_name = group | first %}
          {% unless group_name == "collections" %}
            <li {% if idx == 0 %} class="current" {% endif %} data-show="{{ group | first }}">
              <a href="javascript:void(0)">
              <!-- for category and tags,
                first element is group name
                second (and last) element is an array of posts
              -->
              {{ group | first }}
              <span class="cate-count">{{ group | last | size }}</span>
              </a>
            </li>
          {% assign idx = idx | plus: 1 %}
          {% endunless %}
      {% endfor %}
  </ul>

  {% assign groupIdx = 0 %}
  {% for group in include.groups %}
    {% assign group_name = group | first %}
    {% unless group_name == "collections" %}
      <section class="showcase col-lg-9 col-lg-offset-1 {% if groupIdx > 0 %} hide {% else %} current {% endif %}" data-show="{{ group | first }}">
        {% for posts in group %}
            {% include post_list.html posts=posts groupIdx=groupIdx %}
            {% assign groupIdx = groupIdx | plus: 1 %}
        {% endfor %}
      </section>
    {% endunless %}
  {% endfor %}
</div>